﻿using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using DAL;

namespace BLL
{
    public class DutyBiz
    {
        DutyDao dutyDao = new DutyDao();
        public bool CloseNoUseDuty()
        {
            return dutyDao.CloseNoUseDuty();
        }
         //关闭一个或一组
        public bool CloseDuty(string dutyID)
        {
            return dutyDao.CloseDuty(dutyID);
        }
        //开启一个或一组
        public bool OpenDuty(string dutyID)
        {
            return dutyDao.OpenDuty(dutyID);
        }
        public bool SetDutyType(string dutyType, string filter)
        {
            return dutyDao.SetDutyType(dutyType, filter);
        }
        public DataTable GetLists(string serWord, string statu, string sortWay)
        {
            return dutyDao.GetLists(serWord, statu, sortWay);
        }
        public DataTable GetListsByArray(string idArray)
        {
            return dutyDao.GetListsByArray(idArray);
        }
        public DataTable GetDutyByDeptID(string deptID)
        {
            return dutyDao.GetDutyByDeptID(deptID);
        }

        //
        public bool DelDutyGroup(string empCode)
        {
            return dutyDao.DelDutyGroup(empCode);
        }

        public DataTable GetGroupList()
        {
            return dutyDao.GetGroupList();
        }


        //
        public bool SetDutyLowLimit(string DeptID, string DeptName, string DutyID, string DutyName, string HeightLimitNum, string LowLimitNum)
        {

            SqlParameter para0 = new SqlParameter("@DeptID", SqlDbType.Int);
            SqlParameter para1 = new SqlParameter("@DeptName", SqlDbType.VarChar);
            SqlParameter para2 = new SqlParameter("@DutyID", SqlDbType.Int);
            SqlParameter para3 = new SqlParameter("@DutyName", SqlDbType.VarChar);
            SqlParameter para4 = new SqlParameter("@HeightLimitNum", SqlDbType.SmallInt);
            SqlParameter para5 = new SqlParameter("@LowLimitNum", SqlDbType.SmallInt);
            para0.Value = Int32.Parse(DeptID);
            para1.Value = DeptName;
            para2.Value = Int32.Parse(DutyID);
            para3.Value = DutyName;
            para4.Value = Int32.Parse(HeightLimitNum);
            para5.Value =Int32.Parse( LowLimitNum);


            SqlParameter[] spList = { para0, para1, para2, para3, para4, para5 };
            return dutyDao.SetDutyLowLimit(spList);
        }
        public DataTable GetDutyLists(string tableName, string name)
        {
            return dutyDao.GetDutyLists(tableName, name);
        }

        public DataTable GetDutyLowLimit(string deptID, string dutyName)
        {
            return dutyDao.GetDutyLowLimit(deptID, dutyName);
        }
        public bool DelDutyLowLimit(string deptID)
        {
            return dutyDao.DelDutyLowLimit(deptID);
        }
        //获取 ddlDutyType(不能随便修改) 职位级别中的顺序 显示部门结构时使用
        public string getDutyTypeAbsIndex(string account)
        {
            return dutyDao.getDutyTypeAbsIndex(account);
        }
    }
}
